import Vue from 'vue'
import App from './App.vue'

//引入路由
import router from './router'

import Pagination from './components/Pagination'
import axios from 'axios'
Vue.component(Pagination.name, Pagination)


//引入首页商品分类
import TypeNav from './components/TypeNav'


//引入轮播图
import 'swiper/css/swiper.css'
//引入自己写的轮播图组件
import Carousel from '@/components/Carousel'
//注册全局事件Carousel
Vue.component(Carousel.name, Carousel)


//引入store
import store from './store'


//引入Serach中搜索区
// import { reqGetSearchInfo } from './api';


//表单验证
import "@/utils/validate"



//注册全局事件TypeNav
Vue.component(TypeNav.name, TypeNav),


  //api接口引入 ————测试
  /* import {reqCategoryList} from  "./api"
  reqCategoryList() */


  //关闭生产提醒
  Vue.config.productionTip = false;

//引入mockServe.js---虚假数据
import '@/mock/mockServe'


//按需引入elementUI
import { Button, MessageBox } from 'element-ui';
Vue.component(Button.name, Button);

//统一引入api接口
import *as API from '@/api'

axios.defaults.baseURL =
  process.env.NODE_ENV === "development" ? "" : "http://gmall-h5-api.atguigu.cn";
new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;
    //全局总事件 这样全局都能调用api
    Vue.prototype.$API = API;
    Vue.prototype.$msgbox = MessageBox;
    Vue.prototype.$alert = MessageBox.alert;
  },
  store,  //注册仓库（vuex），此时组件实例的身上多了一个属性$stote属性
  router,  //注册路由

}).$mount('#app')
